package org.rcy.ruicingmarket.resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 吴康桥
 * @Description
 * @date 2022/10/27 15:45
 */
@Transactional
@Service
public class ResourceGroupService {
	@Autowired
	private ResourceGroupDao resourceGroupDao;

	public List<ResourceGroup> getResourceGroupByApiName(String name){
		return StringUtils.isBlank(name) ? null : resourceGroupDao.getResourceGroupByApiName(name);
	}

	public List<ResourceGroup> getResourceGroupByRoleId(Long roleId){
		return resourceGroupDao.getResourceGroupsByRoleId(roleId);
	}

	public void apiBindResourceGroup(Long apiId,Long groupId){
		resourceGroupDao.apiBindResourceGroup(apiId, groupId);
	}
}
